home *** CD-ROM | disk | FTP | other *** search
- class CLineSegment extends CCollisionVolume
- {
- var m_endpoint1;
- var m_endpoint2;
- var m_body;
- var m_radius = 0;
- function CLineSegment(body)
- {
- super(body);
- this.m_endpoint1 = new Vector2D(0,0);
- this.m_endpoint2 = new Vector2D(0,0);
- }
- function UpdateToBodyMotion()
- {
- this.m_endpoint1 = this.m_body._location;
- this.m_endpoint2 = this.m_body._lastLocation;
- }
- function get _length()
- {
- return this.m_endpoint1.GetDistance(this.m_endpoint2);
- }
- function get _radius()
- {
- return this.m_radius;
- }
- function set _radius(radius)
- {
- this.m_radius = radius;
- }
- function get _topLeftCorner()
- {
- return new Vector2D(Math.min(this.m_endpoint1._x - this.m_radius,this.m_endpoint2._x - this.m_radius),Math.min(this.m_endpoint1._y - this.m_radius,this.m_endpoint2._y - this.m_radius));
- }
- function get _bottomRightCorner()
- {
- return new Vector2D(Math.max(this.m_endpoint1._x + this.m_radius,this.m_endpoint2._x + this.m_radius),Math.max(this.m_endpoint1._y + this.m_radius,this.m_endpoint2._y + this.m_radius));
- }
- function MayCollideOnSeparation()
- {
- return true;
- }
- }
-